#define  _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
#include <string.h>
#include <math.h>
typedef long long ll;
int main()
{
	ll t;
	char a[20];
	for (int i = 0; i < 20; i++)
	{
		scanf("%s", &a[i]);
	}
	ll len = strlen(a);
	for (int i = 0; i < len; i++)
	{
		t = i;
		for (int j = t + 1; j < len; j++)
		{
			if (a[j] >= a[t])
				t = j;
		}
		if (a[t] > a[i] && t > i)
		{
			int b = a[i];
			a[i] = a[t];
			a[t] = b;
			break;
		}
	}
	for (int i = 0; i < len; i++)
	{
		printf("%s ", a[i]);
	}
	return 0;
}